/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javamail.speech.util;

import javamail.sip.util.*;
import javamail.web.util.*;

/**
 *
 * @author sriram
 */
public enum eSpeechMsgType {
    NIL("nil", 0, false),
    START("start",1,false),
    SYNTHESIZE("synthesize",2,true),
    RECORD("record",3, false),
    STOPRECORD("stoprecord", 4, false),
    PLAY("play",5, false),
    STOPPLAY("stopplay", 6, false),
    TRANSCRIBE("transcribe",7,true),
    SKIP("skip", 8, true),
    STOP("stop",9, false);

    private final String name;
    private final int index;
    private final boolean parms;
    
    eSpeechMsgType(String name, int index, boolean parms) {
        this.name = name;
        this.index = index;
        this.parms = parms;
    }
    
    public String toName() {
        return name;
    }
 
    public int toIndex() {
        return index;
    }

    public boolean hasParms() {
        return parms;
    }

    public eSpeechMsgType getFromName(String name) {
        name = name.trim().toLowerCase();
        for(eSpeechMsgType sp: eSpeechMsgType.values()) {
            if(sp.name.equalsIgnoreCase(name))
                return sp;
        }
        return NIL;
    }
}
